<!Doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">

<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>登录博客后台</title>

<link rel="shortcut icon" th:href="@{/admin/images/favicon.png}" />
<script th:src="@{/jquery-3.2.1.min.js}"></script>
<script th:src="@{/jantent/assets/js/amazeui.min.js}"></script>
<link rel="stylesheet" th:href="@{/jantent/assets/css/amazeui.min.css}" />
<link rel="stylesheet" th:href="@{/jantent/assets/css/app.css}" />
<script th:src="@{/admin/js/base.js}"></script>
</head>

<script type="text/javascript">
	// onclick触发js
	function login() {
		var username = $.trim($("#username").val());
		var password = $.trim($("#password").val());
		if (username == "") {
			alert("请输入用户名");
			return false;
		} else if (password == "") {
			alert("请输入密码");
			return false;
		}
		//ajax去服务器端校验
		var data = {
			username : username,
			password : password
		};
		$.ajax({
			type : 'POST',
			url : '/blog/admin/checklogin',
			data : data,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					alert("登陆失败请检查您的用户名密码！")
				} else if (data.code == 1) {
					window.location.href = "/blog/admin/index";
				}
			},
		});
	}
	;
</script>

<body>

	<div class="log" onload="">
		<div class="am-g">
			<div
				class="am-u-lg-3 am-u-md-6 am-u-sm-8 am-u-sm-centered log-content">
				<h1 class="log-title am-animation-slide-top">登录blog后台</h1>
				<br>
				<form class="am-form" id="loginForm">

					<div class="am-input-group am-radius am-animation-slide-left">
						<input type="text" class="am-radius" name="username" id="username" />
						<span class="am-input-group-label log-icon am-radius"><i
							class="am-icon-user am-icon-sm am-icon-fw"></i></span>
					</div>
					<br>
					<div
						class="am-input-group am-animation-slide-left log-animation-delay">
						<input class="am-form-field am-radius log-input" placeholder="密码"
							name="password" type="password" id="password" /> <span
							class="am-input-group-label log-icon am-radius"><i
							class="am-icon-lock am-icon-sm am-icon-fw"></i></span>
					</div>
					<br>
					<button type="button"
						class="am-btn am-btn-primary am-btn-block am-btn-lg am-radius am-animation-slide-bottom log-animation-delay"
						onclick="login()">登&nbsp;录</button>
				</form>
			</div>
		</div>

		<footer class="log-footer"> © 2019 made by hxz </footer>
	</div>


</body>
</html>